#include "tracimportsettingspage.h"
#include "tracimportsettingswidget.h"
#include "tracimportprojectselectionpage.h"
#include "tracsettings.h"

#include <QtGui/QVBoxLayout>
#include <QtGui/QTextEdit>
#include <QDebug>

namespace Trac {
namespace Internal {

TracImportSettingsPage::TracImportSettingsPage(TracImportProjectSelectionPage *projectSelectionPage,
                                               QWidget *parent) :
    QWizardPage(parent),
    m_projectSelectionPage(projectSelectionPage),
    m_widget(new TracImportSettingsWidget())
{
    connect(m_widget, SIGNAL(validChanged(bool)), this, SIGNAL(completeChanged()));
    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(m_widget);
    setLayout(layout);
    setTitle(tr("Import settings"));
    setSubTitle(tr("Import settings"));
    setButtonText(QWizard::NextButton, "Import");

}

TracImportSettingsPage::~TracImportSettingsPage()
{

}

void TracImportSettingsPage::initializePage()
{
    if(m_widget->currentProjectIdentifier() != TracSettings::instance()->checkoutDirectory())
        m_widget->initialize();
}

bool TracImportSettingsPage::isComplete() const
{
    return m_widget->isValid();
}


} // namespace Internal
} // namespace Trac

